﻿using FS.Common.DotNetBean;
using FS.Common.DotNetCode;
using FS.Common.DotNetUI;
using FS.Business;
using System;
using System.Collections;
using System.Data;

namespace FS.Web.BLL.Visa
{
    public partial class Visa_ResultVisaOKForm : PageBase
    {
        private string _key;
        private visa_dao _visa = new visa_dao();
        protected void Page_Load(object sender, EventArgs e)
        {
            this._key = base.Request["key"];
            if (!base.IsPostBack)
            {
                this.info_receivedate.Value = DateTime.Now.ToString("yyyy-MM-dd");
                if (!string.IsNullOrEmpty(this._key))
                {
                    this.InitData();
                }
            }
        }

        private void InitData()
        {
            Hashtable ht = DataFactory.Run().GetHashtableById("Visa_Info", "Info_ID", this._key);
            if (ht.Count > 0 && ht != null)
            {
               ControlBindHelper.SetWebControls(this.Page, ht);
            }
        }
        protected void Save_Click(object sender, EventArgs e)
        {
            Hashtable ht = new Hashtable();
            ht = ControlBindHelper.GetWebControls(this.Page);
            string ls_userid = RequestSession.GetSessionUser().UserId.ToString();
            string ls_username = RequestSession.GetSessionUser().UserName.ToString();
            
            if (!string.IsNullOrEmpty(this._key))
            {
                ht["Info_ID"] = this._key;
                ht["ModifyDate"] = DateTime.Now;
                ht["ModifyUserId"] = ls_userid;
                ht["ModifyUserName"] = ls_username;
            }
            ht["Ref_infoflag"] = "ResultOK";

            bool IsOk = DataFactory.Run().Submit_AddOrEdit("Visa_Info", "Info_ID", this._key, ht);
            if (IsOk)
            {
                ShowMsgHelper.AlertMsg("操作成功！");
            }
            else
            {
                ShowMsgHelper.Alert_Error("操作失败！");
            }           
        }
    }
}